/*
 * @Copyright: (C) 2019 Zhang Rida. All rights reserved.
 *
 * @Author: Zhang Rida
 * @Email: 215154317@qq.com
 * @FilePath: /WEILA_SDK_MODULE/include/wl_trace.h
 * @Date: 2021-02-18 15:07:07
 * @Description:type define for weila osal
 *
 * @LastEditors: Zhang Rida
 * @LastEditTime: 2022-08-04 15:57:16
 */
#ifndef _WL_TRACE_H
#define _WL_TRACE_H

#include "wl_types.h"

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

void    wl_trace_config(wl_bool isopen, wl_uint32 level);
void    wl_trace_regist_callback(wl_trace_callback callback);
void    wl_trace(wl_int32 level, const wl_char* format, ...);
int     wl_trace_weilapb(const wl_char* format, ...);
wl_bool wl_trace_is_open(void);

#define WLLOG_VERBOSE_LEVEL 0
#define WLLOG_INFO_LEVEL 1
#define WLLOG_DEBUG_LEVEL 2
#define WLLOG_WARN_LEVEL 3
#define WLLOG_ERROR_LEVEL 4
#define WLLOG_LEVEL_MAX 5

#define FULL_WLLOG 1

#ifdef WIN32
#    define WLLOGT(format, args...)
#    define WLLOGI(format, args...)
#    define WLLOGD(format, args...)
#    define WLLOGW(format, args...)
#    define WLLOGE(format, args...)
#else
#    if FULL_WLLOG
#        define WLLOGT(format, args...)                                                                                \
            // wl_trace(WLLOG_VERBOSE_LEVEL, "%s|%d: " format "\n", __FUNCTION__, __LINE__, ##args);
#        define WLLOGI(format, args...)                                                                                \
            // wl_trace(WLLOG_INFO_LEVEL, "%s|%d: " format "\n", __FUNCTION__, __LINE__, ##args);
#        define WLLOGD(format, args...)                                                                                \
            wl_trace(WLLOG_DEBUG_LEVEL, "%s|%d: " format "\n", __FUNCTION__, __LINE__, ##args);
#        define WLLOGW(format, args...)                                                                                \
            wl_trace(WLLOG_WARN_LEVEL, "%s|%d: " format "\n", __FUNCTION__, __LINE__, ##args);
#        define WLLOGE(format, args...)                                                                                \
            wl_trace(WLLOG_ERROR_LEVEL, "%s|%d: " format "\n", __FUNCTION__, __LINE__, ##args);
#    else
#        define WLLOGT(format, args...)  // wl_trace(WLLOG_VERBOSE_LEVEL, ":" format "\n", ##args);
#        define WLLOGI(format, args...)  // wl_trace(WLLOG_INFO_LEVEL, ":" format "\n", ##args);
#        define WLLOGD(format, args...) wl_trace(WLLOG_DEBUG_LEVEL, ":" format "\n", ##args);
#        define WLLOGW(format, args...) wl_trace(WLLOG_WARN_LEVEL, ":" format "\n", ##args);
#        define WLLOGE(format, args...) wl_trace(WLLOG_ERROR_LEVEL, ":" format "\n", ##args);
#    endif
#endif

#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _WL_TRACE_H */
